package com.ruoyi.user.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.PersonInfoMapper;
import com.ruoyi.user.domain.PersonInfo;
import com.ruoyi.user.service.IPersonInfoService;

/**
 * 老人信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-24
 */
@Service
public class PersonInfoServiceImpl implements IPersonInfoService 
{
    @Autowired
    private PersonInfoMapper personInfoMapper;

    /**
     * 查询老人信息
     * 
     * @param personId 老人信息主键
     * @return 老人信息
     */
    @Override
    public PersonInfo selectPersonInfoByPersonId(Long personId)
    {
        return personInfoMapper.selectPersonInfoByPersonId(personId);
    }

    /**
     * 查询老人信息列表
     * 
     * @param personInfo 老人信息
     * @return 老人信息
     */
    @Override
    public List<PersonInfo> selectPersonInfoList(PersonInfo personInfo)
    {
        return personInfoMapper.selectPersonInfoList(personInfo);
    }

    /**
     * 新增老人信息
     * 
     * @param personInfo 老人信息
     * @return 结果
     */
    @Override
    public int insertPersonInfo(PersonInfo personInfo)
    {
        personInfo.setCreateTime(DateUtils.getNowDate());
        return personInfoMapper.insertPersonInfo(personInfo);
    }

    /**
     * 修改老人信息
     * 
     * @param personInfo 老人信息
     * @return 结果
     */
    @Override
    public int updatePersonInfo(PersonInfo personInfo)
    {
        return personInfoMapper.updatePersonInfo(personInfo);
    }

    /**
     * 批量删除老人信息
     * 
     * @param personIds 需要删除的老人信息主键
     * @return 结果
     */
    @Override
    public int deletePersonInfoByPersonIds(Long[] personIds)
    {
        return personInfoMapper.deletePersonInfoByPersonIds(personIds);
    }

    /**
     * 删除老人信息信息
     * 
     * @param personId 老人信息主键
     * @return 结果
     */
    @Override
    public int deletePersonInfoByPersonId(Long personId)
    {
        return personInfoMapper.deletePersonInfoByPersonId(personId);
    }
}
